<template>
	<view>
		<!-- 顶部导航部分 -->
		<view class="top">
			<view class="bg"></view>
			<view class="title_header">
				<view class="jiantou"></view>
				<text>发放优惠券</text>
			</view>
		</view>
		
		<!-- 卡片部分 -->
		<view>
			<uni-card>
				<!-- 优惠名称部分 -->
				<view class="titletime">
					<text class="title" >优惠券名称</text>
					<input ></input>
				</view>
				
				<!-- 优惠券类型 -->
				 <view class="youhuititle">
					<text class="title">优惠券类型</text>
					<view class="type">
						
						<view class="yi">
							<text class="one">满减券</text>
							<image src="../../static/车联网服务商家端-07卡券管理3-发放优惠券_slices/椭圆 3 拷贝@2x.png"></image>
							<text class="two">打折券</text>
							<image src="../../static/车联网服务商家端-07卡券管理3-发放优惠券_slices/组 6@2x.png"></image>
						</view>
						
						<view class="right" >
							打<input/>折
						</view>
						
					</view>
					
				</view>
				
				<!-- 发放开发时间 -->
				<view class="time">
					<view class="open_end_time">发放开始时间</view>
					<view class="selecttime">
						<picker mode="date">
							<view>{{startDate}}</view>
						</picker>
						<image src="/static/gengduojiantou.png"></image>
					</view>
				</view>
				<view class="time">
					<view class="open_end_time">发放结束时间</view>
					<view class="selecttime">
						<picker mode="date">
							<view>{{endDate}}</view>
						</picker>
						<image src="/static/gengduojiantou.png"></image>
					</view>
				</view>
				
				<!-- 投放数量 -->
				<view class="number">
					<view class="youhuititle1">
						<text class="title1">投放数量</text>
					</view>
					<input /><text style="color: black;">张</text>
				</view>
				<view class="number">
					<view class="youhuititle1">
						<text class="title1" >每人限领</text>
					</view>
					<input /><text style="color: black;">张</text>
				</view>
				
				<!-- 使用有效期 -->
				<view class="youxiaoqi">
					<view class="youhuititle1">
						<text class="title1">使用有效期</text>
					</view>
					<view class="selecttime1" >
						<picker  mode="date" >
							<view>开始时间</view>
						</picker>
						<image src="/static/gengduojiantou.png"></image>
					</view>
					
					<view class="selecttime1" style="margin-left: 10rpx;">
						<picker  mode="date" >
							<view>结束时间</view>
						</picker>
						<image src="/static/gengduojiantou.png"></image>
					</view>
				</view>
			</uni-card>
		</view>
		
		<!-- 保存按钮 -->
		<view class="save">
			确认投放
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			const currentDate = this.getDate({
					format: true
				})
			return {
				/* 发放优惠券的开始时间和结束时间 */
				startDate:this.getDate(),
				endDate:this.getDate(),
				/* 使用有效期的开始时间和结束时间 */
				startdate:this.getDate(),
				enddate:this.getDate()
			}
		},
		
		methods: {
			getDate() {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			}
		}
	}
</script>

<style>
	/* 导航栏样式 */
		.top{
			width: 750rpx;
		}
		.bg{
			position: absolute;
			background-color: #3785f6;
			width: 750rpx;
			height: 450rpx;
		}
		.title_header{
			display: flex;
			padding-top: 60rpx;
		}
		.title_header>text{
			font-size: 35rpx;
			color: white;
			margin-left: 248rpx;
		}
		.jiantou{
			border-bottom: 6rpx solid white;
			border-left: 6rpx solid white;
			width: 20rpx;
			height: 20rpx;
			margin-left: 20rpx;
			transform: rotate(45deg);
		}
		
		/* 优惠名称样式 */
		.titletime{
			display: flex;
			color: #151515;
			line-height: 88rpx;
			align-items: center;
		}
		
		.titletime .title{
			font-weight: bold;
			width: 150rpx;
		}
		.titletime>input{
			margin-left: 65rpx;
			width: 400rpx;
			height: 56rpx;
			border:1rpx solid #c3c3c3;
			border-radius: 29rpx;
			padding-left: 13rpx;
			padding-right: 13rpx;
		}
		/* 优惠类型 */
		.youhuititle{
			display: flex;
			color: #151515;
			line-height: 88rpx;
		}
		.youhuititle .title{
			font-weight: bold;
			width: 150rpx;
		}
		.type{
			display: flex;
			flex-direction: column;
			margin-top: 23rpx;
			margin-left: 70rpx;
		}
		.yi{
			display: flex;
			align-items: center;
		}
		.two{
			margin-left: 60rpx;
		}
		.yi image{
			margin-left: 10rpx;
			width: 30rpx;
			height: 30rpx;
		}
		.right{
			height: 54rpx;
			display: flex;
		}
		.right input{
			height: 100%;
			border-bottom: 1rpx solid black;
			width: 120rpx;
			margin-left: 4rpx;
		}

		/* 发放开始和结束时间样式 */
		.time{
			display: flex;
			margin-top: 60rpx;
			align-items: center;
		}
		.open_end_time{
			font-weight: bold;
			width: 180rpx;
			color: black;
			margin-right: 40rpx;
		}
		.selecttime{
			display: flex;
			align-items: center;
			width: 260rpx;
			height: 65rpx;
			text-align: center;
			border: 1rpx solid #c3c3c3;
			border-radius: 29rpx;
			color: #c3c3c3;
			padding-left: 12rpx;
		}
		.selecttime image{
			padding-left: 60rpx;
			width: 19rpx;
			height: 17rpx;
		}
		
		/* 投放数量样式 */
		.number{
			display: flex;
			align-items: center;
			margin-top: 50rpx;
		}
		.number input{
			border: 1rpx solid #d0d0d0;
			width: 100rpx;
			height: 29rpx;
			border-radius: 20rpx;
			margin-right: 8rpx;
		}
		.youhuititle1 .title1{
			font-weight: bold;
			width: 150rpx;
			color: #151515;
			margin-right: 110rpx;
		}
		
		/* 使用有效期的样式 */
		.youxiaoqi{
			display: flex;
			align-items: center;
			margin-top: 39rpx;
		}
		.selecttime1{
			display: flex;
			justify-content: space-around;
			align-items: center;
			width: 153rpx;
			height: 65rpx;
			text-align: center;
			border: 1rpx solid #c3c3c3;
			border-radius: 29rpx;
			color: #c3c3c3;
			padding-left: 10rpx;
			font-size: 25rpx;
			margin-right: 20rpx;
		}
		.selecttime1 image{
			/* padding-left: 25rpx; */
			width: 19rpx;
			height: 17rpx;
		}
		.youxiaoqi .selecttime1{
			margin-left: -30rpx;
		}

	/* 确认投放按钮样式 */
	.save{
		line-height: 79rpx;
		width: 517rpx;
		height: 74rpx;
		border: 1rpx solid  white;
		border-radius: 30rpx;
		text-align: center;
		margin-left: 120rpx;
		margin-top: 65rpx;
		color: white;
		background-color: #1b6fea;
	}
</style>
